package com.hdaccp.shuiguoD.service.impl;

import com.hdaccp.shuiguoD.dao.KehuDao;
import com.hdaccp.shuiguoD.entity.Kehu;
import com.hdaccp.shuiguoD.service.KehuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class KehuServiceImpl implements KehuService {
    @Autowired
    private KehuDao kehuDao;

    @Override
    public List<Kehu> getAll() {
        return kehuDao.queryAll();
    }

    @Override
    public long findTotalCount(String kname) {
        return kehuDao.getTotalCount(kname);
    }

    @Override
    public List<Kehu> findAll(String kname, int offset, int limit) {
        return kehuDao.query(kname,offset,limit);
    }

    @Override
    public int delte(int kid) {
        return kehuDao.delet(kid);
    }

    @Override
    public int zj(Kehu kehuinfo) {
        return kehuDao.add(kehuinfo);
    }

    @Override
    public int update(Kehu kehuinfo) {
        return kehuDao.update(kehuinfo);
    }


    /**
     * 根据ID查询
     * @param kid
     * @return
     */
    public Kehu queryById(int kid){
        return kehuDao.queryById(kid);
    }
}
